/**
 * Copyright © 2009 Qasky. All rights reserved.
 *
 * 系统附件请求接口
 *
 * @author Wang Hongya
 * @version 0.0.0 2019/10/14
 *
 * History:
 * (author, date, desc)
 * (Wang Hongya, 20191014, 添加注释)
 */

import {findSysAttaInfos} from 'api/sysAttaApi';

/* 系统附件的状态管理 */
const sysAtta = {
    state: {
        flag: false,
        sysAttaInfoDTOs: [],
        sorts:[],
        page: {
            currentPage: 1,
            pageSize: 5,
            total: 0
        }
    },
    mutations: {
          findSysAttaInfosMu(state, obj) {
            if (obj.rows !== '') {
                state.sysAttaInfoDTOs = obj.rows;
                state.page.currentPage = obj.currentPage;
                state.page.pageSize = obj.pageSize;
                state.page.total = obj.total;
            }
        },
        loadSortsMu(state, obj){
          state.sorts = obj;
        }
    },
    actions: {
        /*获取系统附件列表数据请求*/
        findSysAttaInfosAct (context, para) {
          findSysAttaInfos(para).then(response => {
                let data = response.data;
                context.commit('findSysAttaInfosMu', data);
            });
        }
    }
};

export default sysAtta;
